package com.zwps.biz.controller.http;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zwps.biz.api.model.dto.dsmdrfsrhrds.DsmDfrSrhrdsDTO;
import com.zwps.biz.api.model.dto.dsmspgpzwl.DsmHistoryDateDTO;
import com.zwps.biz.api.model.vo.dsmdfrsrhrds.*;
import com.zwps.biz.api.model.vo.dsmspgpzwl.DsmHistoryDateVo;
import com.zwps.biz.api.model.vo.pubsectionall.PubSectionAllVOS;
import com.zwps.biz.domain.service.DsmDfrSrhrdsService;
import com.zwps.biz.domain.service.PubSectionAllService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author dzc
 * @date 2024/9/18 19:59
 * @description
 */


@RestController
@Validated
@RequestMapping("safety/displacement")
public class DsmDfrSrhrdsController {

    @Autowired
    private DsmDfrSrhrdsService srhrdsService;


    @Tag(name = "安全监测")
    @PostMapping("/horizontal")
    @Operation(summary = "获取水平位移")
    public List<DsmAVO> getHorizontal(@Valid @NotNull @RequestBody DsmDfrSrhrdsDTO srhrdsDTO) {

        return srhrdsService.getHorizontal(srhrdsDTO);
    }

    @Tag(name = "安全监测")
    @PostMapping("/side_seam")
    @Operation(summary = "侧缝计、机器视觉数据获取")
    public List<DsmAVO> getSideSeam(@Valid @NotNull @RequestBody DsmDfrSrhrdsDTO srhrdsDTO) {
        return srhrdsService.getSideSeam(srhrdsDTO);
    }

    @Tag(name = "安全监测")
    @PostMapping("/horizontal/min_max")
    @Operation(summary = "获取水平位移最大最小值")
    public List<DsmDfrSrhrdsMinMaxVO> getMinMax(@Valid @NotNull @RequestBody DsmDfrSrhrdsDTO srhrdsDTO) {

        return srhrdsService.getMinMax(srhrdsDTO);
    }

    @Tag(name = "安全监测")
    @GetMapping("/getStation")
    @Operation(summary = "获取测点")
    public  List<PubSectionAllVOS> getStation() {

        return srhrdsService.getData();
    }


    @Tag(name = "安全监测")
    @GetMapping("/getLastStation")
    @Operation(summary = "获取实时水平位移数据")
    public List<DsmDfrSrhrdsVO> getLastStation() {

        return srhrdsService.getLastStation();
    }

    @Tag(name = "安全监测")
    @PostMapping("/getDsmDfrSrhrdsByMpcd")
    @Operation(summary = "获取历史水平位移数据")
    public IPage<DsmAVO> getDsmDfrSrhrdsByMpcd(@Valid @NotNull @RequestBody DsmHistoryDateDTO historyDateDTO) {

        return srhrdsService.getDsmDfrSrhrdsByMpcd(historyDateDTO);
    }

}